<template>
  <div>
    <div class="topsa">
      <div class="piliang">批量发货</div>
    </div>
    <!-- 底部内容 -->
    <div class="bottoms">
      <p>批量上传</p>
      <p>功能介绍：使用excel快速导入进行商品上传</p>
      <p style="margin-bottom: 50px">如重复导入数据将以最新导入数据，请谨慎使用</p>
      <p style="margin-bottom: 20px">数据导入订单状态自动修改为已上架</p>
      <p style="margin-bottom: 20px">一次导入的数据不要太多，大量数据请分批导入，建议在服务器低运行的时候使用</p>
      <p>使用方法：</p>
      <p style="margin-bottom: 20px">1.下载Excel模板文件并录入信息</p>
      <p>2.上传Excel导入</p>
    </div>
    <el-upload class="upload-demo" ref="upload" action="https://jsonplaceholder.typicode.com/posts/" :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList" :auto-upload="false">
      <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
      <el-button style="margin-left: 10px" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
      <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
    </el-upload>
    <div class="footers">
      <div class="footers_left">确认导入</div>
      <div class="footers_left footers_lefts">下载模板文件</div>
      <div class="footers_left footers_leftss">取消</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fileList: [],
    }
  },
  methods: {
    submitUpload() {
      this.$refs.upload.submit()
    },
    handleRemove(file, fileList) {
      console.log(file, fileList)
    },
    handlePreview(file) {
      console.log(file)
    }
  },
}
</script>

<style lang="scss" scoped>
.topsa{
  width: 100%;
  height: 30px;
  margin-bottom: 30px;
  .piliang{
    width: 100px;
    height: 100%;
    background: #FF9800;
    border-radius: 5px;
    color: white;
    line-height: 30px;
    text-align: center;
  }
}
.bottoms {
  width: 600px;
  height: 400px;
  border: 1px solid #ddd;
  padding: 20px;
  box-sizing: border-box;
  margin-bottom: 50px;
}
.footers{
  width: 100%;
  height: 40px;
  position: relative;
  top: 50px;
  display: flex;
  .footers_left{
    width: 100px;
    height: 30px;
    background: #0790F5;
    text-align: center;
    line-height: 30px;
    color: white;
    margin-right: 40px;
  }
  .footers_lefts{
    width: 220px;
    background: #DCB73F;
  }
  .footers_leftss{
    background: #EB0000;
  }
}
</style>
